<?php
namespace Home\Model;
use Think\Model;

class UsersModel extends Model{
	protected $_validate = array(
       array('username', 'require', '账号必须！', 1),
       array('username', '', '账号已经存在', 0, 'unique', self::
       	 MODEL_INSERT),
       array('username','administrator',array('administrator','admin'),
         '用户名不能是administrator或admin',1,'notin'),
	   array('pass', 'require', '密码必须！', 1),
	   array('pass2','pass','两次密码不一致',0,'confirm'),
       array('realname', 'require', '真实姓名必须'),
	   array('email', 'require', '邮箱必须！', 1),
      );


protected $_auto = array(
  //为think_users表的createtime字段生成当前的日期
    array('createtime','getdate',self::MODEL_INSERT, 'callback'),
  //为think_users表的pass字段进行md5加密
    array('pass','md5', self::MODEL_INSERT, 'function'),
    );
   function getdate(){
    return date('Y-m-d');
}
}
?>